package com.jueban.Vo;

import com.jueban.model.user.User;
import com.jueban.util.Enum.JobType;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.BeanUtils;

import java.util.Date;

@Getter
@Setter
public class UserVo {

    private Integer id;

    private Integer age;

    private String username;

    private String idNumber;

    private String name;

    private Date birthday;

    private String gender;

    private String userType;

    private String department;

    private String jobType;

    private String phone;

    private String email;

    public UserVo(User user) {
        BeanUtils.copyProperties(user, this, "gender", "userType","jobType");
        gender = user.getGender().toString();
        userType = user.getUserType().toString();
        if(user.getJobType() != null){
            jobType = user.getJobType().toString();
        }
    }
}
